import { userInfo } from 'os'
import Vue from 'vue'
import Vuex from 'vuex'
import { createVuexPersistedState } from 'vue-persistedstate'
import { stat } from 'fs'

Vue.use(Vuex)
export default new Vuex.Store({
  plugins: [
    createVuexPersistedState({
      // // 默认值vuex
      // key: 'userState',
      // // 缓存的介质localStorage、sessionStorage
      // storage: window.localStorage,
      // // 白名单 要缓存的数据，刷新不会丢失，重新打开也不会丢失
      // whiteList: ['loginState'],
      // // 黑名单 不缓存的数据，刷新丢失
      blackList: ['toPath','fromPath'],
    }),
  ],
  state: {
    acType:null,
    device: "", // 设备类型 
    userType: "",
    regShow:false,
    toPath:'',
    fromPath:'',
    userInfo: {
      // id: "",//id
      // depart_code:"",//学校编号
      // name: "",//学校名称
      // grade: "",//入学学年
      // education:"",//学历
      // gender:"",//性别
    }, //学生信息
  },
  // mutaions 是唯一的修改vuex 的statrt数据的地方(同步)
  mutations: {
    changeActype(state,payload){
        state.acType = payload;
    },
    changeToPath(state,payload){
      state.toPath = payload;
    },
    changeFromPath(state,payload){
      state.fromPath = payload;
    },
    changeUserInfo(state,payload){
      state.userInfo = payload;
    },

    changeRegShow(state,payload){
      state.regShow = payload;
    },
    // 设备类型 
    getDevice(state, payload) {
      state.device = payload;
    },
    getUserType(state, payload) {
      state.userType = payload;
    },

  },
  actions: {
  },
  modules: {
  }
})
